<%@page import="cn.com.xf.common.StringUtil"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<Tbdamagedgoods> list = (List<Tbdamagedgoods>)request.getAttribute("list");
	DamagedgoodsForm form = (DamagedgoodsForm)request.getAttribute("command");
	String entertimeStart = StringUtils.isNotBlank(form.getEntertimeStart())?form.getEntertimeStart():"";
	String entertimeEnd = StringUtils.isNotBlank(form.getEntertimeEnd())?form.getEntertimeEnd():"";
%>
<div class="main">
	<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>破损件查看</li>
			</ul>
		</div>
	<div class="oaTable">
<table class="tableList imgtable">
	<thead>
		<tr>
			<td colspan="3" style="width: 100%;">
				<div class="FormTools">
					<div>
						<input style="height: 24px;width: 75px" type="button" class="searchSubmit" value="搜索" 
							onclick="javascript:XF.Goods.listDamagedSearch('')" />
					</div>
					<div>	
						录入站点：
						<select id="entersite" class="easyui-combobox" name="entersite" style="width:180px;"></select>
					</div>
					<div>单号：
						<input style="height: 24px" id="orderid" type="text" name="orderid"  placeholder="请输入单号" 
							value="<%=StringUtil.StringFilter(form.getOrderid()) %>"/>&nbsp;&nbsp; 
					</div>
					<div class="form-item form-item-two">
				    		<label for="entertime">访问日期:</label>
				    		<input id="entertimeStart" name="entertimeStart" class="easyui-validatebox" type="text" style="height: 24px;width: 75px"  onfocus="WdatePicker({errDealMode:1,dateFmt:'yyyy-MM-dd',minDate:'2017-1-1',maxDate:'%y-%M-%d'})" value="<%=entertimeStart %>">--
				    		<input id="entertimeEnd" name="entertimeEnd" class="easyui-validatebox" type="text" style="height: 24px;width: 75px"  onfocus="WdatePicker({errDealMode:1,dateFmt:'yyyy-MM-dd',minDate:'2017-1-1',maxDate:'%y-%M-%d'})" value="<%= entertimeEnd%>">
				     </div>
				</div>
			</td>
		</tr>
	</thead>
			<tbody>
				<%if(null!=list && list.size()>0){
				int row = (int) Math.ceil((double) list.size()/3);
				for (int i = 0; i < row; i++) {%>
					<tr class="trwidth">
					<%
					for (int j = 3*(i+1)-3; j < 3*(i+1) && j < list.size(); j++) {
						String imgurl = list.get(j).getImgUrl()!=null?list.get(j).getImgUrl():request.getContextPath()+"/images/logo_big.jpg";
						String orderid = list.get(j).getOrderid()!=null?list.get(j).getOrderid():"";
						String entsitename = list.get(j).getEntsitename()!=null?list.get(j).getEntsitename():"";
						String memo = list.get(j).getMemo()!=null?list.get(j).getMemo():"";
						String seqid = list.get(j).getSeqid()!=null?list.get(j).getSeqid():"";
					%>
						<td class="imgheight">
							<div style="margin: 10px">
								<div><input class="img" type="image" onClick="javascript:XF.Faq.getImgURL('<%=seqid %>')" src="<%=imgurl %>" border="0" /></div>
								<div class = "tbs"><p>单号：<%=orderid %></p></div>
								<div class = "tbs"><p>上传站点：<%=entsitename %></p></div>
								<div class = "tbs"><p>描述：<%=memo %></p></div>
							</div>
						</td>
					<%	
					}
					%>
					</tr>
				<%	
				}
			}
			%>
				
		        <tr id="tableFooter">
					<td colspan="3">
						<div class="pagination">
							<monggoTag:pagination href="damaged_search"
								pageSize="<%=form.getPageSize()%>"
								totalRecord="<%=form.getTotalRecord() %>"
								currentPage="<%=form.getPageNum() %>">
							</monggoTag:pagination>
						</div>
					</td>
				</tr>
			</tbody>
</table>
</div>
</div>
<script>
var entersite = '<%=form.getEntersite() %>';
	$('#entersite').combobox({
		url:global.contextPath + '/company/sites',
		valueField:'siteid',
		textField:'sitename',		
	    panelHeight: '300',
	    onHidePanel:function(){
			var _options = $(this).combobox('options');  
		    var _data = $(this).combobox('getData');/* 下拉框所有选项 */  
		    var _value = $(this).combobox('getValue');/* 用户输入的值 */  
		    var _b = false;/* 标识是否在下拉列表中找到了用户输入的字符 */  
		    for (var i = 0; i < _data.length; i++) {  
		        if (_data[i][_options.valueField] == _value) {  
		            _b=true;  
		            break;  
		        }  
		    }  
		    if(!_b){  
		        $(this).combobox('setValue', '');  
		    } 
        },
	});
	$('#entersite').combobox('setValue', entersite);
	var imgh = $(window).height()/3
 	$(".img").attr("width","100%").attr("height",imgh);
	$(window).resize(function() { 
		imgh = $(window).height()/3; 
        $(".img").css("height",imgh); 
    });
	</script>
<style type="text/css">

.tbs{
text-align:left;}
.imgtable{table-layout: fixed;word-break: break-all; word-wrap: break-word; //表格固定布局}
</style>
